package com.cainiao.controller;


import com.cainiao.rabbitMQ.HelloSender;
import com.cainiao.redis.RedisClient;
import com.cainiao.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;




@Controller
public class IndexController {
    final private Logger logger = LoggerFactory.getLogger(IndexController.class);

   @Autowired
    private UserService userService;

    @RequestMapping("/")
    public String index(){
        return "index.html";
    }

    @Autowired
    private RedisClient redisClient;
    @RequestMapping(value = "/test")
    @ResponseBody
    public String redisTest(){
        StringBuffer sb = new StringBuffer();
       // redisClient.set("user", new User());
        sb.append("str=").append(redisClient.get("user").toString());
        return sb.toString();
    }

    @Autowired
    private HelloSender helloSender;
    @RequestMapping("/rabbit")
    public void hello() {
        helloSender.send();
    }

}
